{% extends 'base.html' %}

{% block title %}博客论坛首页{% endblock %}

{% block main %}
    <h1>博客列表</h1>
    <div class="row row-cols-2 row-gap-4">
    {% for blog in blogs %}
            <div class="col">
            <div class="card">
                <div class="card-header">
                    <a href="/detail/{{ blog.id }}">{{ blog.title }}</a>
                </div>
                <div class="card-body" style="height: 100px">
                    <p class="card-text">{{ blog.content|safe |striptags |truncatechars:50}}</p>
                </div>
                <div class="card-footer text-muted d-flex justify-content-between">
                    <div>
                        <img class="rounded-circle" style="height: 30px; width: 30px"
                             src="{% static 'image/avatar.jpg' %}">
                        {{ blog.author }}
                    </div>
                    <div>
                        {{ blog.pub_time }}
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
    </div>

{% endblock %}